package com.ideaaedi.zoo.diy.feature.msg.mq.impl.rocketmq;

import com.ideaaedi.zoo.diy.feature.msg.mq.impl.rocketmq.core.StreamRocketMQSender;
import com.ideaaedi.zoo.diy.feature.msg.mq.impl.rocketmq.properties.ZooMqRocketmqDIYGuideProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.context.annotation.Bean;

/**
 * rocketmq 自动配置
 */
@EnableConfigurationProperties({ZooMqRocketmqDIYGuideProperties.class})
@ConditionalOnProperty(value = ZooMqRocketmqAutoConfiguration.ENABLE, havingValue = "true", matchIfMissing = true)
public class ZooMqRocketmqAutoConfiguration {
    
    public static final String ENABLE = "zoo.switch.feature-msg-mq-by-rocketmq.enable";
    
    @Bean
    public StreamRocketMQSender streamRocketMQSender(StreamBridge streamBridge) {
        return new StreamRocketMQSender(streamBridge);
    }
}